//
//  UIStandardSelectButton.h
//  vhStressTest1
//
//  Created by jia yu on 2021/8/31.
//

#import <UIKit/UIKit.h>
#import <vhECGTools/NSItemObject.h>


/*
 //init and addsubview
 leadSelectorButton = [[UIStandardSelectButton alloc] initWithFrame:CGRectMake(mainView.frame.size.width-180.f * screenRatio , mainView.frame.origin.y, 180.f * screenRatio, 80.f * screenRatio) scale:screenRatio];
 leadSelectorButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleBottomMargin;
 [self addSubview:leadSelectorButton];
 
 //set available items for choose.
 NSMutableArray *items = [[NSMutableArray alloc] init];
 for (int i=0;i<12;i++){
     NSItemObject *item = [[NSItemObject alloc] init];
     item.str = [vhECGTools leadName:i];
     item.inner = i;
     [items addObject:item];
 }
 leadSelectorButton.availableItems = items;
 
 //set current selected string
 [leadSelectorButton setTitle:[vhECGTools leadName:[test.panoLead integerValue]] forState:UIControlStateNormal];
 leadSelectorButton.inner = [test.panoLead integerValue];
 
 
 leadSelectorButton.changedHandler = ^(NSString * _Nonnull targetString) {
    //Do something after selected changed.
     [strongSelf changeToLead:strongSelf->leadSelectorButton.inner];
     return;
 };
 */


typedef void (^UIStandardSelectButton_Changed_Handler) (NSString * _Nonnull targetString);

typedef NS_ENUM(NSInteger, UIStandardSelectButton_Style) {
    UIStandardSelectButton_Style_Default = 0,   //无边框
    UIStandardSelectButton_Style_Board = 1      //有边框
};

NS_ASSUME_NONNULL_BEGIN
@interface UIStandardSelectButton : UIButton
@property (nonatomic) UIStandardSelectButton_Changed_Handler changedHandler;
@property (nonatomic) UIStandardSelectButton_Style style;
@property (nonatomic) NSArray <NSItemObject *>*availableItems;
@property (nonatomic) float inner;
@property (nonatomic) BOOL canSelectNone;       //default is NO.

//Option, when current selected is nil, there is default list seek string
@property (nonatomic) NSString * _Nullable defaultSelectedString;

-(id)initWithFrame:(CGRect)frame scale:(float)scale;
@end

NS_ASSUME_NONNULL_END
